 public void distantaMax(String nr) {
        StringTokenizer st = new StringTokenizer(nr, " ");
        int[] x = new int[st.countTokens()];
        int[] y = new int[st.countTokens()];
        for (int i = 0; i < x.length; i++) {
            StringTokenizer stemp = new StringTokenizer(st.nextToken(), ",");
            x[i] = Integer.parseInt(stemp.nextToken());
            y[i] = Integer.parseInt(stemp.nextToken());
        }
        int i, j;
        double max = 0;
        int p1 = 0, p2 = 0;
        for (i = 0; i < x.length; i++) {
            for (j = i; j < x.length; j++) {
                double dist = Math.sqrt(Math.pow((x[i] - x[j]), 2) + Math.pow((y[i] - y[j]), 2));
                if (dist > max) {
                    max = dist;
                    p1 = i;
                    p2 = j;
                }
            }
        }
        jTextArea2.append("Punctele sunt : (" + x[p1] + "," + y[p1] + ") si (" + x[p2] + "," + y[p2]
                + ") iar distanta dintre ele este " + max);


    }